// Copyright (C) FlatGlobus(wtlbuilder@gmail.com) All rights reserved.
//
// This file is a part of the WTLBuilder.
// The use and distribution terms for this software are covered by the
// Microsoft Public License (http://opensource.org/licenses/MS-PL)
// which can be found in the file MS-PL.txt at the root folder.

#include "stdafx.h"
#include <map>
//////////////////////////////////////////////////////////////////////////
struct IDPair 
{
	_TCHAR *name;
	DWORD   id;
};

static IDPair ids[] = {
	{_T("IDOK"),IDOK},
	{_T("IDCANCEL"),IDCANCEL},
	{_T("IDABORT"),IDABORT},
	{_T("IDRETRY"),IDRETRY},
	{_T("IDIGNORE"),IDIGNORE},
	{_T("IDYES"),IDYES},
	{_T("IDNO"),IDNO},
	{_T("IDCLOSE"),IDCLOSE},
	{_T("IDHELP"),IDHELP},
	{_T("IDTRYAGAIN"),IDTRYAGAIN},
	{_T("IDCONTINUE"),IDCONTINUE},
	{_T("ID_SEPARATOR"),ID_SEPARATOR},
	{_T("ID_DEFAULT_PANE"),ID_DEFAULT_PANE},
	{_T("ATL_IDW_TOOLBAR"),ATL_IDW_TOOLBAR},
	{_T("ATL_IDW_STATUS_BAR"),ATL_IDW_STATUS_BAR},
	{_T("ATL_IDW_COMMAND_BAR"),ATL_IDW_COMMAND_BAR},
	{_T("ATL_IDW_CLIENT"),ATL_IDW_CLIENT},
	{_T("ATL_IDW_PANE_FIRST"),ATL_IDW_PANE_FIRST},
	{_T("ATL_IDW_PANE_LAST"),ATL_IDW_PANE_LAST},
	{_T("ATL_IDW_HSCROLL_FIRST"),ATL_IDW_HSCROLL_FIRST},
	{_T("ATL_IDW_VSCROLL_FIRST"),ATL_IDW_VSCROLL_FIRST},
	{_T("ATL_IDW_SIZE_BOX"),ATL_IDW_SIZE_BOX},
	{_T("ATL_IDW_PANE_SAVE"),ATL_IDW_PANE_SAVE},
	{_T("ATL_IDW_BAND_FIRST"),ATL_IDW_BAND_FIRST},
	{_T("ATL_IDW_BAND_LAST"),ATL_IDW_BAND_LAST},
	{_T("ID_FILE_NEW"),ID_FILE_NEW},
	{_T("ID_FILE_OPEN"),ID_FILE_OPEN},
	{_T("ID_FILE_CLOSE"),ID_FILE_CLOSE},
	{_T("ID_FILE_SAVE"),ID_FILE_SAVE},
	//{_T("ID_FILE_SAVEALL"),ID_FILE_SAVEALL},
	{_T("ID_FILE_SAVE_AS"),ID_FILE_SAVE_AS},
	{_T("ID_FILE_PAGE_SETUP"),ID_FILE_PAGE_SETUP},
	{_T("ID_FILE_PRINT_SETUP"),ID_FILE_PRINT_SETUP},
	{_T("ID_FILE_PRINT"),ID_FILE_PRINT},
	{_T("ID_FILE_PRINT_DIRECT"),ID_FILE_PRINT_DIRECT},
	{_T("ID_FILE_PRINT_PREVIEW"),ID_FILE_PRINT_PREVIEW},
	{_T("ID_FILE_UPDATE"),ID_FILE_UPDATE},
	{_T("ID_FILE_SAVE_COPY_AS"),ID_FILE_SAVE_COPY_AS},
	{_T("ID_FILE_SEND_MAIL"),ID_FILE_SEND_MAIL},
	{_T("ID_FILE_MRU_FIRST"),ID_FILE_MRU_FIRST},
	{_T("ID_FILE_MRU_FILE1"),ID_FILE_MRU_FILE1},
	{_T("ID_FILE_MRU_FILE2"),ID_FILE_MRU_FILE2},
	{_T("ID_FILE_MRU_FILE3"),ID_FILE_MRU_FILE3},
	{_T("ID_FILE_MRU_FILE4"),ID_FILE_MRU_FILE4},
	{_T("ID_FILE_MRU_FILE5"),ID_FILE_MRU_FILE5},
	{_T("ID_FILE_MRU_FILE6"),ID_FILE_MRU_FILE6},
	{_T("ID_FILE_MRU_FILE7"),ID_FILE_MRU_FILE7},
	{_T("ID_FILE_MRU_FILE8"),ID_FILE_MRU_FILE8},
	{_T("ID_FILE_MRU_FILE9"),ID_FILE_MRU_FILE9},
	{_T("ID_FILE_MRU_FILE10"),ID_FILE_MRU_FILE10},
	{_T("ID_FILE_MRU_FILE11"),ID_FILE_MRU_FILE11},
	{_T("ID_FILE_MRU_FILE12"),ID_FILE_MRU_FILE12},
	{_T("ID_FILE_MRU_FILE13"),ID_FILE_MRU_FILE13},
	{_T("ID_FILE_MRU_FILE14"),ID_FILE_MRU_FILE14},
	{_T("ID_FILE_MRU_FILE15"),ID_FILE_MRU_FILE15},
	{_T("ID_FILE_MRU_FILE16"),ID_FILE_MRU_FILE16},
	{_T("ID_FILE_MRU_LAST"),ID_FILE_MRU_LAST},
	{_T("ID_EDIT_CLEAR"),ID_EDIT_CLEAR},
	{_T("ID_EDIT_CLEAR_ALL"),ID_EDIT_CLEAR_ALL},
	{_T("ID_EDIT_COPY"),ID_EDIT_COPY},
	{_T("ID_EDIT_CUT"),ID_EDIT_CUT},
	{_T("ID_EDIT_FIND"),ID_EDIT_FIND},
	{_T("ID_EDIT_PASTE"),ID_EDIT_PASTE},
	{_T("ID_EDIT_PASTE_LINK"),ID_EDIT_PASTE_LINK},
	{_T("ID_EDIT_PASTE_SPECIAL"),ID_EDIT_PASTE_SPECIAL},
	{_T("ID_EDIT_REPEAT"),ID_EDIT_REPEAT},
	{_T("ID_EDIT_REPLACE"),ID_EDIT_REPLACE},
	{_T("ID_EDIT_SELECT_ALL"),ID_EDIT_SELECT_ALL},
	{_T("ID_EDIT_UNDO"),ID_EDIT_UNDO},
	{_T("ID_EDIT_REDO"),ID_EDIT_REDO},
	{_T("ID_WINDOW_NEW"),ID_WINDOW_NEW},
	{_T("ID_WINDOW_ARRANGE"),ID_WINDOW_ARRANGE},
	{_T("ID_WINDOW_CASCADE"),ID_WINDOW_CASCADE},
	{_T("ID_WINDOW_TILE_HORZ"),ID_WINDOW_TILE_HORZ},
	{_T("ID_WINDOW_TILE_VERT"),ID_WINDOW_TILE_VERT},
	{_T("ID_WINDOW_SPLIT"),ID_WINDOW_SPLIT},
	{_T("ATL_IDM_WINDOW_FIRST"),ATL_IDM_WINDOW_FIRST},
	{_T("ATL_IDM_WINDOW_LAST"),ATL_IDM_WINDOW_LAST},
	{_T("ATL_IDM_FIRST_MDICHILD"),ATL_IDM_FIRST_MDICHILD},
	{_T("ID_APP_ABOUT"),ID_APP_ABOUT},
	{_T("ID_APP_EXIT"),ID_APP_EXIT},
	{_T("ID_HELP_INDEX"),ID_HELP_INDEX},
	{_T("ID_HELP_FINDER"),ID_HELP_FINDER},
	{_T("ID_HELP_USING"),ID_HELP_USING},
	{_T("ID_CONTEXT_HELP"),ID_CONTEXT_HELP},
	{_T("ID_HELP"),ID_HELP},
	{_T("ID_DEFAULT_HELP"),ID_DEFAULT_HELP},
	{_T("ID_NEXT_PANE"),ID_NEXT_PANE},
	{_T("ID_PREV_PANE"),ID_PREV_PANE},
	{_T("ID_PANE_CLOSE"),ID_PANE_CLOSE},
	{_T("ID_FORMAT_FONT"),ID_FORMAT_FONT},
	{_T("ID_SCROLL_UP"),ID_SCROLL_UP},
	{_T("ID_SCROLL_DOWN"),ID_SCROLL_DOWN},
	{_T("ID_SCROLL_PAGE_UP"),ID_SCROLL_PAGE_UP},
	{_T("ID_SCROLL_PAGE_DOWN"),ID_SCROLL_PAGE_DOWN},
	{_T("ID_SCROLL_TOP"),ID_SCROLL_TOP},
	{_T("ID_SCROLL_BOTTOM"),ID_SCROLL_BOTTOM},
	{_T("ID_SCROLL_LEFT"),ID_SCROLL_LEFT},
	{_T("ID_SCROLL_RIGHT"),ID_SCROLL_RIGHT},
	{_T("ID_SCROLL_PAGE_LEFT"),ID_SCROLL_PAGE_LEFT},
	{_T("ID_SCROLL_PAGE_RIGHT"),ID_SCROLL_PAGE_RIGHT},
	{_T("ID_SCROLL_ALL_LEFT"),ID_SCROLL_ALL_LEFT},
	{_T("ID_SCROLL_ALL_RIGHT"),ID_SCROLL_ALL_RIGHT},
	{_T("ID_OLE_INSERT_NEW"),ID_OLE_INSERT_NEW},
	{_T("ID_OLE_EDIT_LINKS"),ID_OLE_EDIT_LINKS},
	{_T("ID_OLE_EDIT_CONVERT"),ID_OLE_EDIT_CONVERT},
	{_T("ID_OLE_EDIT_CHANGE_ICON"),ID_OLE_EDIT_CHANGE_ICON},
	{_T("ID_OLE_EDIT_PROPERTIES"),ID_OLE_EDIT_PROPERTIES},
	{_T("ID_OLE_VERB_FIRST"),ID_OLE_VERB_FIRST},
	{_T("ID_OLE_VERB_LAST"),ID_OLE_VERB_LAST},
	{_T("ID_VIEW_TOOLBAR"),ID_VIEW_TOOLBAR},
	{_T("ID_VIEW_STATUS_BAR"),ID_VIEW_STATUS_BAR},
	{_T("ID_VIEW_REFRESH"),ID_VIEW_REFRESH},
	{_T("IDC_STATIC"),IDC_STATIC},
	{_T("ATL_IDS_IDLEMESSAGE"),ATL_IDS_IDLEMESSAGE}
	};

long CorrectControlID(LPCTSTR ID)
{
	for(int i = 0; i < _countof(ids) ; i++)
		if(_tcscmp(ids[i].name,ID) == 0)
			return ids[i].id;
	return -1;
}
